<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>CreateXML</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">CreateXML()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>CreateXML</b></font>(#XML [, Encoding])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Creates a new empty XML tree identified by the #XML number. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#XML</i></td>
<td width="90%"> 
A number to identify the new XML. <a href="../reference/purebasic_objects.html">#PB_Any</a> 可以用来自动生成这个编码. 

</td></tr>
<tr><td><i>Encoding (optional)</i></td>
<td> 
 
The encoding to use for the XML tree. Valid values are: 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_UTF8</font> (default)
  <font color="#924B72">#PB_Ascii</font>
  <font color="#924B72">#PB_Unicode</font>
</font></pre>

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Nonzero if the XML tree was created successfully, zero otherwise. If <font color="#924B72">#PB_Any</font> was used 
for the #XML parameter then the generated number is returned on success. 

 

</blockquote><p><b>备注</b></p><blockquote>



The new XML tree will only have a root node which can be accessed with <a href="rootxmlnode.html">RootXMLNode()</a>. 
To add new nodes, <a href="createxmlnode.html">CreateXMLNode()</a> can be used. 
 
</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; Create xml tree</font>
  xml =<font color="#3A3966"> CreateXML</font>(<font color="#924B72">#PB_Any</font>)
  mainNode =<font color="#3A3966"> CreateXMLNode</font>(<font color="#3A3966">RootXMLNode</font>(xml), "Zoo")
  
  <font color="#3A3966">; Create first xml node (in main node)</font>
  item =<font color="#3A3966"> CreateXMLNode</font>(mainNode, "Animal") 
<font color="#3A3966">  SetXMLAttribute</font>(item, "id", "1") 
<font color="#3A3966">  SetXMLNodeText</font>(item, "Elephant")
  
  <font color="#3A3966">; Create second xml node (in main node)</font>
  item =<font color="#3A3966"> CreateXMLNode</font>(mainNode, "Animal") 
<font color="#3A3966">  SetXMLAttribute</font>(item, "id", "2") 
<font color="#3A3966">  SetXMLNodeText</font>(item, "Tiger")
  
  <font color="#3A3966">; Save the xml tree into a xml file</font>
<font color="#3A3966">  SaveXML</font>(xml, "demo.xml")
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="freexml.html">FreeXML()</a>, <a href="createxmlnode.html">CreateXMLNode()</a>, <a href="rootxmlnode.html">RootXMLNode()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=copyxmlnode.html>CopyXMLNode()</a> - <a href="index.html">XML Index</a> - <a href="createxmlnode.html">CreateXMLNode()</a> -&gt;<br><br>

</body></html>